Python Recipes Handbook by Joey Bernard
Defining an attribute that is meant to be only used within the class in question should be prefixed with at least one underscore character. The usual way this is done is to actually add two underscore characters to both the beginning and ending of the element names, as in Listing 7-5.
class priv_vars:
__a__ = "This is a private variable "
Listing 7-5.Creating a Private Variable
There is a special form of a private name that induces Python to rename the element using a system of name mangling. If you have an element that may have the same name as some other element, you can add at least two leading underscore characters and at most one trailing underscore. Python will then prepend the class name to the element name. For example, if you had a class like
class my_class1:
__a_ = 1